package com.group9.handinhand.controller.form;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.List;

import com.group9.handinhand.service.so.CommunityMemberSO;
import com.group9.handinhand.service.so.CommunitySO;
import com.group9.handinhand.service.so.EventAttenderSO;
import com.group9.handinhand.service.so.EventPostSO;
import com.group9.handinhand.service.so.EventSO;
import com.group9.handinhand.service.so.UserSO;
import com.group9.handinhand.service.so.UserTagSO;
/**
 * 
 * @class EventViewForm
 *	This class is for event view
 */
public class EventViewForm {
	
	UserSO user;
	List<UserTagSO> userTags;
	CommunityMemberSO communityMember;
	EventSO event;
	EventSO moderatedEvent;
	EventAttenderSO eventAttender;
	String post;
	ArrayList<Object> wallElements = new ArrayList<Object>();
	ArrayList<Object> eventList = new ArrayList<Object>();
	List<EventSO> eventListofUser;
	ArrayList<Object> eventListofCommAccTags = new ArrayList<Object>();
	ArrayList<Object> eventListofCommunity = new ArrayList<Object>();
	ArrayList<Object> eventListofRecommendation = new ArrayList<Object>();
	/**
	 * A set method.
	 * Sets the elements in the event wall to the event
	 */
	public void setWallElementsFromEvent(){
		wallElements.addAll(event.getPosts());
		Collections.sort(wallElements, new Comparator<Object>() {
			
			public int compare(Object o1, Object o2) {
				Date o1createDate = ((EventPostSO)o1).getCreateDate();
						
				Date o2createDate = ((EventPostSO)o2).getCreateDate();
				if (o1createDate == null || o2createDate == null)
					return 0;
				return o2createDate.compareTo(o1createDate);
			}
		});

	}
	/**
	 * A getter method.
	 * @return moderatedEvent
	 */
	public EventSO getModeratedEvent() {
		return moderatedEvent;
	}
	/**
	 * A setter method.
	 * @param moderatedEvent
	 */
	public void setModeratedEvent(EventSO moderatedEvent) {
		this.moderatedEvent = moderatedEvent;
	}
	/**
	 * A getter method.
	 * @return communityMember
	 */
	public CommunityMemberSO getCommunityMember() {
		return communityMember;
	}
	/**
	 * A setter method.
	 * @param communityMember
	 */
	public void setCommunityMember(CommunityMemberSO communityMember) {
		this.communityMember = communityMember;
	}
	/**
	 * A getter method.
	 * @return the list of the elements in the event wall
	 */
	public ArrayList<Object> getWallElements() {
		return wallElements;
	}
	/**
	 * A setter method.
	 * @param wallElements
	 */
	public void setWallElements(ArrayList<Object> wallElements) {
		this.wallElements = wallElements;
	}
	/**
	 * A getter method.
	 * @return post
	 */
	public String getPost() {
		return post;
	}
	/**
	 * A setter method.
	 * @param post
	 */
	public void setPost(String post) {
		this.post = post;
	}
	/**
	 * A getter method.
	 * @return event
	 */
	public EventSO getEvent() {
		return event;
	}
	/**
	 * A setter method.
	 * @param event
	 */
	public void setEvent(EventSO event) {
		this.event = event;
	}
	/**
	 * A getter method.
	 * @return user who attends the event
	 */
	public EventAttenderSO getEventAttender() {
		return eventAttender;
	}
	/**
	 * A setter method.
	 * @param eventAttender
	 */
	public void setEventAttender(EventAttenderSO eventAttender) {
		this.eventAttender = eventAttender;
	}
	/**
	 * A getter method.
	 * @return user.
	 */
	public UserSO getUser() {
		return user;
	}
	/**
	 * A setter method.
	 * @param user
	 */
	public void setUser(UserSO user) {
		this.user = user;
	}
	/**
	 * A getter method.
	 * @return the list of user tags
	 */
	public List<UserTagSO> getUserTags() {
		return userTags;
	}
	/**
	 * A setter method.
	 * @param userTags
	 */
	public void setUserTags(List<UserTagSO> userTags) {
		this.userTags = userTags;
	}
	/**
	 * A getter method.
	 * @return the list of event
	 */
	public ArrayList<Object> getEventList() {
		return eventList;
	}
	/**
	 * A setter method.
	 * @param eventList
	 */
	public void setEventList(ArrayList<Object> eventList) {
		this.eventList = eventList;
	}

	/**
	 * A getter method.
	 * @return the list of event for specific user.
	 */
	public List<EventSO> getEventListofUser() {
		return eventListofUser;
	}
	/**
	 * A setter method.
	 * @param eventListofUser
	 */
	public void setEventListofUser(List<EventSO> eventListofUser) {
		this.eventListofUser = eventListofUser;
	}
//	/**
//	 * A getter method.
//	 * @return the list of 
//	 */
//	public ArrayList<Object> getEventListofCommAccTags() {
//		return eventListofCommAccTags;
//	}
//	/**
//	 * A setter method.
//	 * @param eventListofCommAccTags
//	 */
//	public void setEventListofCommAccTags(ArrayList<Object> eventListofCommAccTags) {
//		this.eventListofCommAccTags = eventListofCommAccTags;
//	}

	
	/**
	 * A getter method.
	 * @return eventListofCommunity
	 */
	public ArrayList<Object> getEventListofCommunity() {
		return eventListofCommunity;
	}
	/**
	 * A setter method.
	 * @param eventListofCommunity
	 */
	public void setEventListofCommunity(ArrayList<Object> eventListofCommunity) {
		this.eventListofCommunity = eventListofCommunity;
	}
	/**
	 * A getter method.
	 * @return	the list of recommendation of the event
	 */
	public ArrayList<Object> getEventListofRecommendation() {
		return eventListofRecommendation;
	}
	/**
	 * A setter method.
	 * @param eventListofRecommendation
	 */
	public void setEventListofRecommendation(
			ArrayList<Object> eventListofRecommendation) {
		this.eventListofRecommendation = eventListofRecommendation;
	}
	/**
	 * To string method which converts EventViewForm class into a string
	 */
	@Override
	public String toString() {
		return "EventViewForm [event=" + event + ", eventAttender="
				+ eventAttender + ", post=" + post + ", wallElements="
				+ wallElements + "]";
	}
	

}
